# -*- coding: utf-8 -*-
"""
滑动窗口函数：
把图片切成很多不同尺寸的小块图片
并且返回这些切好的图片
"""

def sliding_window(image, step, window_size):
    for y in range(0, image.shape[0], step):   #y在0, image.shape[0]之间每隔step取一次值
    #for y in xrange(0, image.shape[0], step):
        #for x in xrange(0, image.shape[1], step):
        for x in range(0, image.shape[1], step):
            yield (x, y, image[y:y + window_size[1], x:x + window_size[0]])
